//
//  TestViewController.m
//
//  Copyright iOSDeveloperTips.com All rights reserved.
//

#import "HelpViewController.h" 
#import <MediaPlayer/MediaPlayer.h>
#import "AppDelegate.h"
#import "TSO_Setup_TableViewCell.h"
#import "ReaderPDFController.h"
@implementation HelpViewController
@synthesize AppleDeglate;

#pragma mark -
#pragma mark Initialization


-(id) init{
    
    self =[ super init] ;
    
	if (self ) {
              
        
        NSString *DisplayName;
        DisplayName=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; 
        //標記:幫助help 編輯        
       
        //透過iSHOW U 錄製 設定為 iPhone->Simulator w/Staus
        
        
        //投資組合!!!!!!!!!
        data_url_portfolio=[[NSMutableArray alloc] init];
		 
        NSMutableDictionary *tdata;
        
         tdata=[[NSMutableDictionary alloc]  init];
         [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to create a portfolio?",@"如何新增加一投資組合?") ]  forKey:@"title"]; 
         [tdata setObject: @"How_to_create_a_portfolio.mov"   forKey:@"urls"]; 
         [data_url_portfolio addObject:tdata];
         [tdata release];
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to arrange a portfolio?", @"如何對投資進行組合排列？" ) ]  forKey:@"title"]; 
        [tdata setObject: @"How_to_arrange_a_portfolio.mov"  forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];        
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to delete a portfolio?",@"如何刪除一投資組合？") ]  forKey:@"title"]; 
        [tdata setObject: @"How_to_delete_a_portfolio.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to add a ticker?",@"如何增加一檔股票？") ]  forKey:@"title"]; 
        [tdata setObject: @"How_to_add_a_ticker.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];
       
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to use symbol to search?",@"如何利用代號搜尋？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_use_symbol_to_search.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString( @"How to use name to search?",@"如何利用名稱搜尋？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_use_name_to_search.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];
        
              
        
        //注意此段要考慮到istock global 不要顯示在其他單一國家
        //標記:Add Target need Program         
        if([DisplayName isEqualToString:@"2D_BASIC_LF_iPhone_iStock Global"] || [DisplayName isEqualToString:@"2D_BASIC_LF_iPad_iStock Global"]  || [DisplayName isEqualToString:@"2D_BASIC_MESA_iPhone_Global"] ){
            tdata=[[NSMutableDictionary alloc]  init];
            [tdata setObject:[NSString stringWithString:NSLocalizedString( @"How to add more country in portfolio?" ,@"如何增加更多國家別來進行搜尋")]  forKey:@"title"]; 
            [tdata setObject: @"How_to_add_more_country_in_portfolio.mov"   forKey:@"urls"]; 
            [data_url_portfolio addObject:tdata];
            [tdata release];          
        }   
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString( @"How to rename a symbol in watchlist?",@"如何編輯股票名稱？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_rename_a_symbol_in_watchlist.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];         
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString( @"How to add a new IPO symbol?",@"如何增加一檔新上市股票？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_add_a_new_IPO_symbol.mov"   forKey:@"urls"]; 
        [data_url_portfolio addObject:tdata];
        [tdata release];        
        
        //報價表!!!!!!!!
        data_url_table=[[NSMutableArray alloc] init];        
        
           
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to change the title of table?" ,@"如何更換在報價表上的標題？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_change_the_title_of_table.mov"   forKey:@"urls"]; 
        [data_url_table addObject:tdata];
        [tdata release];    
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to refresh table?" ,@"如何更新報價表？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_refresh_table.mov"   forKey:@"urls"]; 
        [data_url_table addObject:tdata];
        [tdata release];  
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to sort the title of table?" ,@"如何對報價表進行排序？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_sort_the_title_of_table.mov"   forKey:@"urls"]; 
        [data_url_table addObject:tdata];
        [tdata release];             
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to find the strongest bullish stock?" ,@"如何找到最牛股票？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_find_the_strongest_bullish_stock.mov"   forKey:@"urls"]; 
        [data_url_table addObject:tdata];
        [tdata release]; 
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to find stock in bullish right now?" ,@"如何找正在牛市的股票？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_find_stock_in_bullish_right_now.mov"   forKey:@"urls"]; 
        [data_url_table addObject:tdata];
        [tdata release];         
        
        //走勢圖!!!!!!!
         data_url_graph=[[NSMutableArray alloc] init];        
       
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to change indicator?" ,@"如何更換指標？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_change_indicator.mov"  forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release];
        
        //標記:判斷是MESA或LF
            
        NSArray * DisplayName_array=[ DisplayName componentsSeparatedByString:@"_"];    
        
        if ([DisplayName_array count]>=3) {
            if ([[DisplayName_array objectAtIndex:2] isEqualToString:@"MESA"] ) {
                //MESA
                //目前 新的core plot 無法放大縮小 所以先將此功能暫停
                
            }
            else{
                //開始LF
                tdata=[[NSMutableDictionary alloc]  init];
                [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to zoom out or zoom in?" ,@"如何放大或縮小？")]  forKey:@"title"]; 
                [tdata setObject: @"How_to_zoom_out_or_zoom_in.mov"  forKey:@"urls"]; 
                [data_url_graph addObject:tdata];
                [tdata release];    
                
                
            }
        }
        
          
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to move chart?" ,@"如何移動走勢圖？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_move_chart.mov"   forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release]; 
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to chinage ticker in chart?" ,@"如何在走勢圖內更換商品標的？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_chinage_ticker_in_chart.mov"  forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release]; 
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to see the OPHL data?" ,@"如何察看開低收盤資料？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_see_the_OPHL_data.mov"  forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release]; 	
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to change color of up or down?" ,@"如何改變上漲或下跌顏色？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_change_color_of_up_or_down.mov"   forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release];         
        
        tdata=[[NSMutableDictionary alloc]  init];
        [tdata setObject:[NSString stringWithString:NSLocalizedString(@"How to change start date on chart?" ,@"如何起始日？")]  forKey:@"title"]; 
        [tdata setObject: @"How_to_change_start_date_on_chart.mov"   forKey:@"urls"]; 
        [data_url_graph addObject:tdata];
        [tdata release];           
         
    }
	return self;
	
}
-(void)get_navcontroller:(navcontroller *)nd{
	navdelegete=nd;
}
-(void)initTitle:(NSString *)bartitle{
	self.title=bartitle;
	
}
-(void)initImage:(UIImage*)image{
	self.tabBarItem.image= image ;
}
- (void)loadView{
 	 UIView *mainview;
	 mainview=[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame];
	 self.view=mainview;
    [mainview release];
    
	 self.view.backgroundColor=[UIColor lightTextColor];
    
	
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
        
        
       if ( [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString:@"UIInterfaceOrientationPortrait 垂直"] || [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString: @"UIInterfaceOrientationPortraitUpsideDown 垂直"] ){
            //垂直
              myTable =[[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f,610.0f)  style:UITableViewStyleGrouped];                                    
        }
        else{
             myTable =[[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f,660.0f)  style:UITableViewStyleGrouped];
        }         
        
        
        
        
    }
    else{
          myTable =[[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f,self.view.frame.size.height)  style:UITableViewStyleGrouped];        
                
    }    
    
    
    
    
    
    
  
    
    
	
	myTable.dataSource = self;	//連結資料 UITableViewDataSource
	myTable.delegate=self; //連結動作 UITableViewDelegate	
	[self.view addSubview:myTable];
    
	
    
    
}

#pragma mark -
#pragma mark 播放通知
// 偵測播放畫面是否恢復原來大小
- (void)resumeViewSize:(NSNotification*)aNotification{
	NSLog(@"Resized!");
} 
-(void)NowPlayingMovieDidChangeNotification:(NSNotification*)aNotification{
 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

}
-(void)resizeframe{
    NSLog(@"resizeframe_a");
    //NSLog(@"playerController=%p", playerController  );
    
    if (playerController !=nil) {
        CGRect f = self.view.frame;        
        NSLog(@"resizeframe_b");
       if ( [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString:@"UIInterfaceOrientationPortrait 垂直"] || [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString: @"UIInterfaceOrientationPortraitUpsideDown 垂直"] ) {
            //垂直
            f.size.width = 768;//704
            f.size.height = 960;//724
            f.origin.x = 0;//
            f.origin.y = 44;//44          
        }
        else{
            //水平
            f.size.width = 704;//704
            f.size.height = 706;//724
            f.origin.x = 0;//
            f.origin.y = 44;//44              
        }
        playerController.view.frame=f;   
        
     }

}
- (void)PlaybackDidFinishNotification:(NSNotification*)aNotification{
	MPMoviePlayerController * player = aNotification.object;
    NSLog(@"a.PlaybackDidFinishNotification retain count=%i",[player  retainCount]);
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerWillExitFullscreenNotification object:player ] ; 
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player ] ; 
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerNowPlayingMovieDidChangeNotification  object:player ] ; 
    
    NSLog(@"b.PlaybackDidFinishNotification retain count=%i",[player  retainCount]);
    
    player.initialPlaybackTime = -1; 
    
    [player stop]; 
     
    //[player autorelease];
  
     
    playerController=nil;
     
} 
-(void) releaseplay{

    playerController.initialPlaybackTime = -1; 
    
    [playerController stop]; 
    
    [playerController autorelease];
    
    
    playerController=nil;
}
#pragma mark -
#pragma mark 播放
 
-(void)playMovie:(NSString *)surl{
    NSLog(@"-(void)playMovie");
    
    
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
       
         NSString *wurl=@"";
       
        //標記:判斷是MESA或LF
        NSString *DisplayName;
        DisplayName=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];     
        NSArray * DisplayName_array=[ DisplayName componentsSeparatedByString:@"_"];    
        
        if ([DisplayName_array count]>=3) {
            if ([[DisplayName_array objectAtIndex:2] isEqualToString:@"MESA"] ) {
                //MESA
                
                
                wurl=[NSString stringWithFormat:@"http://www.xxtradexx.com/help_video/MESA/iPad_%@",surl];     
                
                
            }
            else{
                //開始LF
                
                
                wurl=[NSString stringWithFormat:@"http://www.xxtradexx.com/help_video/LF/iPad_%@",surl];            
            }
        }
        
        
     
        
        //主圖消失            
        [[(AppDelegate * )AppleDeglate Master_popController]  dismissPopoverAnimated:YES];         
        
        
        CGRect f = self.view.frame;
        
        //1024 *768 44                  
        if ( [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString:@"UIInterfaceOrientationPortrait 垂直"] || [[(AppDelegate * )AppleDeglate interfaceOrientation_ipad] isEqualToString: @"UIInterfaceOrientationPortraitUpsideDown 垂直"] ) {
            //垂直
            f.size.width = 768;//704
            f.size.height = 960;//724
            f.origin.x = 0;//
            f.origin.y = 44;//44          
        }
        else{
            //水平
            f.size.width = 704;//704
            f.size.height = 706;//724
            f.origin.x = 0;//
            f.origin.y = 44;//44              
        }
      
        
        NSURL *url =  [[NSURL alloc] initWithString:  wurl];
        
        if( playerController==nil){
            
            
            
            playerController =  [[MPMoviePlayerController alloc] initWithContentURL:url]  ;		
            
                       
            
        }else {
            NSLog(@"playerController!=nil ");
            
                 
            playerController =  [[MPMoviePlayerController alloc] initWithContentURL:url]  ;	     
            [playerController setContentURL:url];
            
        } 
        playerController.view.frame=f;   
        
        [[(AppDelegate * )AppleDeglate dv ].view addSubview:playerController.view  ];                        
           
        
        if([(AppDelegate * )AppleDeglate splitViewDelegate].toolBar != nil) {
            
            [[(AppDelegate * )AppleDeglate splitViewDelegate] add_toolbar_item];
            
        }
        
        
        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                 selector:@selector(resumeViewSize:) 
                                                     name:MPMoviePlayerScalingModeDidChangeNotification 
                                                   object:playerController];
        
        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                 selector:@selector(PlaybackDidFinishNotification:) 
                                                     name:MPMoviePlayerPlaybackDidFinishNotification 
                                                   object:playerController];         
        
        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                 selector:@selector(NowPlayingMovieDidChangeNotification:) 
                                                     name:MPMoviePlayerNowPlayingMovieDidChangeNotification 
                                                   object:playerController];         
        
        
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;        
        
        [playerController play]; 
        
        [url release];	     
              
        
        
    }    
    else{
        NSString *wurl=@"";
        //標記:判斷是MESA或LF
        NSString *DisplayName;
        DisplayName=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];     
        NSArray * DisplayName_array=[ DisplayName componentsSeparatedByString:@"_"];    
        
        if ([DisplayName_array count]>=3) {
            if ([[DisplayName_array objectAtIndex:2] isEqualToString:@"MESA"] ) {
                //MESA
                
                wurl=[NSString stringWithFormat:@"http://www.xxtradexx.com/help_video/MESA/iPhone_%@",surl];      
                
                
            }
            else{
                //開始LF
                
                wurl=[NSString stringWithFormat:@"http://www.xxtradexx.com/help_video/LF/iPhone_%@",surl];             
            }
        }
        
        
        
        
             
      
        NSURL *movieURL = [[NSURL alloc] initWithString:  wurl];
        
        MPMoviePlayerViewController *mp;
        mp=[[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
        
        [movieURL release];
        [self presentMoviePlayerViewControllerAnimated:mp];
        [mp release];    
        
    }

}

#pragma mark -
#pragma mark 表格

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}

//表格列數
 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
	switch (section) {
		case 1:
			return   [data_url_portfolio count]; 
			break;
        case 2:
			return   [data_url_table count];
			break;  
        case 3:
			return   [data_url_graph count]; 
			break;
        case 0:{
            //標記:判斷是MESA或LF
            NSString *DisplayName;
            DisplayName=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];     
            NSArray * DisplayName_array=[ DisplayName componentsSeparatedByString:@"_"];    
            
            if ([DisplayName_array count]>=3) {
                if ([[DisplayName_array objectAtIndex:2] isEqualToString:@"MESA"] ) {
                    //MESA
                    return   1; //標記:幫助help-Instructions                    
                    break;         
                }
                else{
                    //開始LF
                     return   3; //標記:幫助help-Instructions
                     break;                 
                }
                
            }
            else{
                return   0; //標記:幫助help-Instructions
                break;                
            
            }             
        
        
        }
                  
        default:
            return 0;
            break;
	} 
}
//表格內容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
	static NSString *CellIdentifier = @"TableCellAddStockWatchList";
    
    TSO_Setup_TableViewCell *cell =(TSO_Setup_TableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
	
	if (cell == nil) {
        cell = [[[TSO_Setup_TableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }
	cell.textLabel.text = @"test1";	
	cell.textLabel.font=[UIFont boldSystemFontOfSize:14];
	
	switch (indexPath.section) {
		case 1:{
			if (indexPath.row<[data_url_portfolio count]) {
			    cell.textLabel.text =[[data_url_portfolio objectAtIndex:indexPath.row] objectForKey:@"title"];
            }
            
			break;
		}
        case 2:{
			if (indexPath.row<[data_url_table count]) {
			    cell.textLabel.text =[[data_url_table objectAtIndex:indexPath.row] objectForKey:@"title"];
            }
            
			break;
		}   
        case 3:{
			if (indexPath.row<[data_url_graph count]) {
			    cell.textLabel.text =[[data_url_graph objectAtIndex:indexPath.row] objectForKey:@"title"];
            }
            
			break;
		}   
        case 0:{
			//標記:幫助help-Instructions            
            if (indexPath.row==0) {
			    cell.textLabel.text =NSLocalizedString(@"Instructions-English",@"說明書-英文版");
              
            }
            else if (indexPath.row==1) {
			    cell.textLabel.text =NSLocalizedString(@"Instructions-Chinese(Simplified)",@"說明書-簡體中文版");   
            }   
            else if (indexPath.row==2) {
			    cell.textLabel.text =NSLocalizedString(@"Instructions-Chinese(Traditional)",@"說明書-繁體中文版"); 
            }              
            
			break;
		}               
            
            
	}
	if ([cell.textLabel.text isEqualToString:@"資料起始日"]  ){
		
		cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
	}	
	else {
		cell.accessoryType=UITableViewCellAccessoryNone;		
	}		
	
        
    
    
	return cell;
}
 
//表格敲擊
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
    
	if (indexPath.section==1  ) {
		[self releaseplay];
        [self playMovie:[[data_url_portfolio objectAtIndex:indexPath.row] objectForKey:@"urls"]];
        		 
	}
    else if (indexPath.section==2  ) {
		[self releaseplay];
        [self playMovie:[[data_url_table objectAtIndex:indexPath.row] objectForKey:@"urls"]];
        
	}    
    else if (indexPath.section==3  ) {
		[self releaseplay];
        [self playMovie:[[data_url_graph objectAtIndex:indexPath.row] objectForKey:@"urls"]];
        
	}    
	else if (indexPath.section==0  ) {
		//標記:幫助help-Instructions
        
        
        NSLog(@"Table select-instructuments");
        
        if (indexPath.row==0) {
            
                        
            ReaderPDFController *readerDemoController;
            //標記:判斷是MESA或LF
            NSString *DisplayName;
            DisplayName=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];     
            NSArray * DisplayName_array=[ DisplayName componentsSeparatedByString:@"_"];    
            
            if ([DisplayName_array count]>=3) {
                if ([[DisplayName_array objectAtIndex:2] isEqualToString:@"MESA"] ) {
                    //MESA
                      readerDemoController = [[ReaderPDFController alloc] initPdfFilename:@"2D_BASIC_MESA_iPhoneiPad_OTHER_help_english.pdf"];        
                }
                else{
                    //開始LF
                       readerDemoController = [[ReaderPDFController alloc] initPdfFilename:@"2D_BASIC_LF_iPhoneiPad_OTHER_help_english.pdf"];                    
                }
                
            }            
              
                        
            readerDemoController.AppleDeglate=AppleDeglate;
            [navdelegete pushViewController:readerDemoController animated:YES];
             
             
            
        }
        else if(indexPath.row==1){
            
            
            ReaderPDFController *readerDemoController;
            readerDemoController = [[ReaderPDFController alloc] initPdfFilename:@"2D_BASIC_LF_iPhoneiPad_CH_help_ChineseSimplied.pdf"];            
            readerDemoController.AppleDeglate=AppleDeglate;
            [navdelegete pushViewController:readerDemoController animated:YES];                
            
        }
        else if(indexPath.row==2){
                        
            
            ReaderPDFController *readerDemoController;
            readerDemoController = [[ReaderPDFController alloc] initPdfFilename:@"2D_BASIC_LF_iPhoneiPad_HK_help_ChineseTraditional.pdf"];            
            readerDemoController.AppleDeglate=AppleDeglate;
            [navdelegete pushViewController:readerDemoController animated:YES];                
            
        }
                
        
        
        
       
	}        
    
    
}
//表格標題
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
  
    
    if (section==1) {
          return NSLocalizedString(@"Video Help:Portfolio",@"影片教學:投資組合") ;
    }
    else if (section==2) {
        return NSLocalizedString(@"Video Help:Quote Table",@"影片教學:報價表") ;
    }
    else if (section==3) {
        return NSLocalizedString(@"Video Help:Chart",@"影片教學:走勢圖") ;
    }    
    else if (section==0) {
        return NSLocalizedString(@"Instructions",@"說明書") ;
    }
    else{
      return @"其他";    
    
    }
}
#pragma mark -
#pragma mark 結束
- (void)dealloc 
{
    
    [data_url_portfolio release];
    
	[playerController release];  
	[super dealloc];
}

@end
